public class Singletontest08 {
    static {
        System.out.println("枚举方式!");
    }

    public static void main(String[] args) {
        Singleton08 instance=Singleton08.INSTANCE;
        Singleton08 instance2=Singleton08.INSTANCE;
        System.out.println(instance == instance2);
        System.out.println(instance.hashCode());
        System.out.println(instance2.hashCode());
    }
}
enum Singleton08{
    INSTANCE;
    public void sayOk(){
        System.out.println("ok--");
    }
}
